package leetcode101.bit_operation;

import java.util.Scanner;

/**
 * @author Synhard
 * @version 1.0
 * @Class Code9
 * @Description 693. 交替位二进制数
 * 给定一个正整数，检查它的二进制表示是否总是 0、1 交替出现：换句话说，就是二进制表示中相邻两位的数字永不相同。
 *
 * @tel 13001321080
 * @email 823436512@qq.com
 * @date 2021-05-06 10:09
 */
public class Code9 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(hasAlternatingBits(n));
    }

    public static boolean hasAlternatingBits(int n) {
        while (n > 0) {
            int pop = n % 2;
            n /= 2;
            if (pop == n % 2) {
                return false;
            }
        }
        return true;
    }
}
